package com.forlove.app;

import android.app.Notification;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.forlove.app.common.base.CommonAppliction;
import com.forlove.app.common.base.CommonConfig;
import com.growingio.android.sdk.collection.Configuration;
import com.growingio.android.sdk.collection.GrowingIO;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import cn.magicwindow.Session;

/**
 * Created by yjl on 2017/9/26.
 */

public class ForloveApplication extends CommonAppliction {

    @Override
    public void onCreate() {
        super.onCreate();

        GrowingIO.startWithConfiguration(this, new Configuration()
                .useID()
                .trackAllFragments()
                .setChannel("quanyiquan"));

//        GrowingIO.getInstance().setGeoLocation(latitude, longitude);
//        GrowingIO.getInstance().clearGeoLocation();
        CommonConfig.setLogEnable(ForloveConfig.IS_DEBUG);
        JPushInterface.setDebugMode(ForloveConfig.IS_DEBUG);
        JPushInterface.init(this);

        BasicPushNotificationBuilder builder2 = new BasicPushNotificationBuilder(this);
        builder2.statusBarDrawable = R.mipmap.ic_launcher;
//        builder2.notificationFlags = Notification.FLAG_AUTO_CANCEL; // 设置为自动消失
        builder2.notificationDefaults = Notification.DEFAULT_SOUND
                | Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS; // 设置为铃声与震动都要
        JPushInterface.setDefaultPushNotificationBuilder(builder2);

        PlatformConfig.setWeixin(ForloveConfig.WEIXINKEY, ForloveConfig.WEIXINVALUE);
        PlatformConfig.setQQZone(ForloveConfig.QQKEY, ForloveConfig.QQVALUE);
        PlatformConfig.setSinaWeibo(ForloveConfig.WEIBOKEY, ForloveConfig.WEIBOVALUE, "http://sns.whalecloud.com");
        UMShareAPI.get(this);
        //魔窗session功能注册
        Session.setAutoSession(this);
        //Fresco初始化
        Fresco.initialize(this);
    }

    @Override
    public void exit() {
        Session.onKillProcess();
        super.exit();
    }
}
